<?php
declare (strict_types = 1);

namespace app\api\model;

use think\Model;
use think\facade\Cache;
/**
 * @mixin \think\Model
 */
class Area extends Model
{
    public static function getAreas(){

    	 $areas       = Cache::get('areas');
        if (!$areas) {
            $areas = self::field('areacode as id,areaname as name,uppk as parentid,level', 'areacode')->select()->toArray();

            $areas = array_column($areas, null, 'id');

            Cache::set('areas', $areas);
        }

        return $areas;

    }
}
